package main

func main() {

}

/**
 * @Description:借助双指针进行排序
 */
func wayTwoPoint(nums1 []int, nums2 []int) float64 {
	left, right := 0, 0
	nums := make([]int, 0)
	for left < len(nums1) && right < len(nums2) {
		if nums1[left] < nums2[right] {
			nums = append(nums, nums1[left])
			left++
		} else {
			nums = append(nums, nums2[right])
			right++
		}
	}

	for left < len(nums1) {
		nums = append(nums, nums1[left])
		left++
	}

	for right < len(nums2) {
		nums = append(nums, nums2[right])
		right++
	}
	length := len(nums)
	temp := length >> 1
	if length%2 == 0 {
		return float64(nums[temp]+nums[temp-1]) / 2
	}
	return float64(nums[temp])
}
